<!DOCTYPE html>
<html xmlns=http://www.w3.org/1999/xhtml xmlns:bd=http://www.baidu.com/2010/xbdml>
<head>
    <meta charset="utf-8">
    <title>公告列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/staff/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/staff/layout/css/font_eolqem241z66flxr.css" media="all" />
    <script type="text/javascript" src="/staff/layout/js/jquery.min.js"></script>
</head>
<body>
     {{ csrf_field() }}
    <form style="padding: 4px;" class="layui-form" id="form" action="" method="">        
        <input type="" name="bt" placeholder="请输入您的合同名称" style="width: 100%;height: 3em;border: 1px solid #e2e2e2;margin-bottom: 10px;">
        <textarea style="width: 100%;height: 30em;" id="nr"  placeholder="请输入您的合同内容"></textarea>
        <div class="layui-form-item" style="margin-top: 20px;">
            <div class="layui-input-block" style="margin-left: 0px">
                <button class="layui-btn" lay-submit="" lay-filter="addPact">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary"  >重置</button>
            </div>
        </div>
    </form>  
<script type="text/javascript" src="/pc/layout/js/jquery.min.js"></script>
<script type="text/javascript" src="/pc/layui/layui.js"></script>
<script>
layui.config({
    base : "js/"
}).use(['form','layer','jquery','layedit','laydate'],function(){
    var form = layui.form();
        layer = parent.layer === undefined ? layui.layer : parent.layer,
        $ = layui.jquery;

    form.on("submit(addPact)",function(data){
       console.log($("#nr").val());
        console.log($('input[name=bt]').val());
         var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
         $.ajax({
             type:'post',
             url:'/admin/pact/store',
             async:false,
             data:{
                '_token':$('input[name=_token]').val(),
                 'htname':$('input[name=bt]').val(),
                 'htneirong':$("#nr").val()
             },
             dataType:'json',
             success:function (data) {
                if(data.status == 1){
                    top.layer.close(index);
                    top.layer.msg("合同添加成功！");
                    layer.closeAll("iframe");
                    //刷新父页面
                    parent.location.reload();
                }else{
                    top.layer.close(index);
                    top.layer.msg("合同添加失败！");
                }
             }
         })
        return false;
    })
})
</script>

</body>
</html>